﻿using BusinessLogicLayer;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PresentationLayer
{
    public delegate void HienThiDanhSachTangCa(List<TangCa> ds);
    public partial class frmTimKiemTangCa : Form
    {
        HienThiDanhSachTangCa hienthi;
        public frmTimKiemTangCa(HienThiDanhSachTangCa hienthi)
        {
            InitializeComponent();
            this.hienthi = hienthi;
        }

        private void frmTimKiemTangCa_Load(object sender, EventArgs e)
        {
            dtiNgay.Value = DateTime.Today;
        }

        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            ActionResultAsList<TangCa> rs = new TangCaManager().TimTheoNgay(dtiNgay.Value);
            if (rs.Success)
            {
                if (rs.ObjectList.Count > 0)
                {
                    hienthi(rs.ObjectList);
                    return;
                }
            }
            MessageBox.Show("Không tin thấy thông tin tăng ca nào.", "Thống báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
